#ifndef FONT_H
#define FONT_H

#include<stdbool.h>

#include "Picture.h"
#include "ak_common.h"
#include "ak_common_graphics.h"
#include "ak_tde.h"

#define srcHeight 64
#define srcHeightMax 64
#define StringLenMax 20

#pragma pack(1)
struct RGBA
{
    unsigned char Red;
    unsigned char Green;
    unsigned char Blue;
    unsigned char Alpha;
};
#pragma pack()

typedef struct charOBJ
{
    enum _charType
    {
        CharType_Ascii,
        CharType_Chinese
    }charType;

    char *fontFilePrefix;
    char *charPtr;
    char dataBuf[srcHeightMax*srcHeightMax/8];
    int charHeight;
}CharOBJ;

typedef struct __StringOBJTypedef
{
    char string[StringLenMax];
    char *fontFilePrefix;
    void *rgbaVarAddr;
    struct RGBA stringRGB;        //字符串颜色
    struct ak_tde_layer srcLayer; //字符串图层
    int stringHeight;             //字符高度

    struct _dstPos
    {
        int centerTop;
        int centerLeft;
    }dstPos;

}StringOBJTypedef;
/**
 * @brief 将中文字符转为点阵
 * 
 * @param _src 汉字对象
 * @param out_mat 输出点阵对象
 */
int ReadChineseChar(CharOBJ *_OBJ);

/**
 * @brief 将ASCII字符转为点阵
 * 
 * @param _src ASCII字符对象
 * @param out_mat 输出点阵对象
 */
int ReadAsciiChar(CharOBJ *_OBJ);


/**
 * @brief 释放字符串内存
 * 
 */
void freeStringMem(StringOBJTypedef *_obj);

int switchString2Rgba(StringOBJTypedef *_obj);


#endif